/*
 * UI.h
 *
 *  Created on: 2025/8/13
 *      Author: doititit
 */

#ifndef UI_H
#define UI_H
#include <stdint.h>
#include "Display.h"
#include "DisplayEvents.h"


#define UI_PAGE_COUNT 5


typedef enum
{
    PAGE_STAGE_WAITING,
    PAGE_STAGE_EXECUTING,
    PAGE_STAGE_FINISHED
}Page_Stage_Enum;

typedef struct 
{
    Page_Stage_Enum Page_Stage;
    uint16_t Continue_Time;
    void (*Update)(void);
}Page_Typedef;

typedef struct 
{
    uint8_t Unexecuted_Count;
    uint16_t Time_Counter;
    Page_Typedef * Default_Page;
    Page_Typedef * Pages[UI_PAGE_COUNT];
}UI_Typedef;

void UI_Task_1ms(UI_Typedef *_ui);
void UI_Add_Page(UI_Typedef *_ui, Page_Typedef *page);
void UI_Add_Default_Page(UI_Typedef *_ui, Page_Typedef *page);
void UI_Init(UI_Typedef *_ui);

extern UI_Typedef Car_UI;

extern Page_Typedef Default_Page;
extern Page_Typedef Shao_Page;
extern Page_Typedef Bmi_Green_Page;
extern Page_Typedef Bmi_Blue_Page;
extern Page_Typedef Bmi_Orange_Page;
extern Page_Typedef Bmi_Yellow_Page;

#endif
